package CollectionsFramework;

import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

public class TreeMapTest {

    public static void main(String[] args){
        Map<User,String> map = new TreeMap<>();
        map.put(new User("张三",1),"abc");
        map.put(new User("张三",2),"abc");
        map.put(new User("张三",3),"abc");
        map.put(new User("张三",4),"abc");


        Iterator<Map.Entry<User, String>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<User, String> next = iterator.next();
            System.out.println(next.getKey());
//            System.out.println(next.getValue());
        }


    }
}